package btp.Calendars.Tests;

import java.io.InputStream;
import java.net.*;

public class Downloader {
	
	public static void main(String[] args) throws Exception{
		//Set the http proxy to webcache.mydomain.com:8080
		
		 SocketAddress addr = new InetSocketAddress("202.141.80.22", 3128);
		 Proxy proxy = new Proxy(Proxy.Type.HTTP, addr);
		 
		 URL url = new URL("http://java.sun.com/");
		 URLConnection conn = url.openConnection(proxy);
		 System.out.println(conn.getContent());

		//System.setProperty("http.proxyHost", "202.141.80.22");
		//System.setProperty("http.proxyPort", "3128");

		// Next connection will be through proxy.
		//URL url = new URL("http://java.sun.com/");
		//InputStream in = url.openStream();

		// Now, let's 'unset' the proxy.
		//System.setProperty("http.proxyHost", null);

		// From now on http connections will be done directly.
	}

}
